package com.dysoft.flesh;

import com.dysoft.bones.DataManager;

/**
 * @author Sean Micklethwaite
 *         Aug 14, 2010 10:08:27 PM
 */
public interface Texture extends Renderer {
	void bind(RenderContext ctx, int unit) throws DataManager.DataObject.NotPresentException;
	void unbind(RenderContext ctx, int unit) throws DataManager.DataObject.NotPresentException;

	public static class Bind implements RenderComponent {
		final Texture texture;
		final int unit;

		public Bind(Texture texture, int unit) {
			this.texture = texture;
			this.unit = unit;
		}

		public void activate(RenderContext ctx) throws DataManager.DataObject.NotPresentException {
			texture.bind(ctx, unit);
		}

		public void deactivate(RenderContext ctx) throws DataManager.DataObject.NotPresentException {
			texture.unbind(ctx, unit);
		}

		public Texture getTexture() {
			return texture;
		}

		public int getUnit() {
			return unit;
		}
	}
}
